/*
 * Copyright Radosław Smogura, 2012. All rights reserved.
 *
 * The content of this file is confidential and it is intelectual property
 * of copyright owners.
 * 
 *
 * $URL: http://reprap-ide.googlecode.com/svn/trunk/RepRapIDE/RepRapProject/src/main/java/eu/softper/reprap/project/RepRapProjectFactory.java $
 * $Id: RepRapProjectFactory.java 3 2012-11-19 10:58:30Z mail@smogura.eu $
 * $Revision: 3 $
 */
package eu.softper.reprap.project;

import java.io.IOException;
import org.netbeans.api.project.Project;
import org.netbeans.spi.project.LookupProvider;
import org.netbeans.spi.project.ProjectFactory;
import org.netbeans.spi.project.ProjectState;
import org.openide.util.lookup.ServiceProvider;

/** The structure of RepRap project
 * project-dir
 *  |- private - project private date
 *  |- elements - stl files
 *  |- reprap-project.xml
 *
 * @author Radosław Smogura
 */
@ServiceProvider(service=ProjectFactory.class)
public class RepRapProjectFactory implements ProjectFactory{
    public static final String REPRAP_XML = "reprap-project.xml";
    
    @Override
    public boolean isProject(org.openide.filesystems.FileObject fo) {
        return fo.getFileObject(REPRAP_XML) != null;
    }

    @Override
    public Project loadProject(org.openide.filesystems.FileObject fo, ProjectState ps) throws IOException {
        if (!isProject(fo))
            return null;
        return RepRapProject.loadProject(fo);
    }

    @Override
    public void saveProject(Project prjct) throws IOException, ClassCastException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
}
